﻿<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:local="clr-namespace:MyMedia_App"
  xmlns:resx="clr-namespace:MyMedia_App.Properties"
  x:Class="MyMedia_App.VolumeControl"
  x:ClassModifier="internal"
  x:Name="UserControl"
  d:DesignWidth="100" d:DesignHeight="12">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="VolumeSliderStyle.xaml"/>
      </ResourceDictionary.MergedDictionaries>

      <Style x:Key="MinVolButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="False"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Grid x:Name="buttonLayout">
                <Path
                  Fill="#FF373737" Stretch="Fill" Stroke="#FF373737"
                  Width="8.947" Height="8.801" SnapsToDevicePixels="True"
                  RenderTransformOrigin="0.413849969744492,0.579279987504855"
                  Data="M6.2672172,0.5 L8.4472275,2.6800102 6.9359999,4.1912377 6.9359999,8.301125 0.5,1.8651251 4.902092,1.8651251 z"
                  Canvas.Left="69.362" Canvas.Top="34.321">
                  <Path.Effect>
                    <DropShadowEffect Color="#FFFFFFFF" ShadowDepth="1" BlurRadius="0" Direction="325"/>
                  </Path.Effect>
                  <Path.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform ScaleX="-1" ScaleY="1"/>
                      <SkewTransform AngleX="0" AngleY="0"/>
                      <RotateTransform Angle="-45"/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </Path.RenderTransform>
                </Path>
                <Path
                  x:Name="waves" Stretch="Fill" Stroke="#FF5B5B5B" StrokeThickness="0.7"
                  Width="2.714" Height="5.152"
                  Data="M74.205436,50.108614 C74.205436,50.108614 79.955984,54.608614 74.205326,59.858614"
                  Margin="4.877,0,0,0" />
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger Property="Tag" Value="IsMuted">
                  <Setter TargetName="waves" Property="Visibility" Value="Hidden" />
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>

      <Style x:Key="MaxVolButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Grid x:Name="buttonLayout">
                <!--Path
                  Fill="#FF373737" Stretch="Fill" Stroke="#FF373737" 
                  RenderTransformOrigin="0.413849969744492,0.579279987504855"
                  Data="M6.2672172,0.5 L8.4472275,2.6800102 6.9359999,4.1912377 6.9359999,8.301125 0.5,1.8651251 4.902092,1.8651251 z"
                  Margin="0,0.974,2.91,2.308"-->
                <Path
                  Fill="#FF373737" Stretch="Fill" Stroke="#FF373737"
                  Width="8.947" Height="8.801" SnapsToDevicePixels="True"
                  RenderTransformOrigin="0.413849969744492,0.579279987504855"
                  Data="M6.2672172,0.5 L8.4472275,2.6800102 6.9359999,4.1912377 6.9359999,8.301125 0.5,1.8651251 4.902092,1.8651251 z"
                  Canvas.Left="69.362" Canvas.Top="34.321">

                  <Path.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform ScaleX="-1" ScaleY="1"/>
                      <SkewTransform AngleX="0" AngleY="0"/>
                      <RotateTransform Angle="-45"/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </Path.RenderTransform>
                  <Path.Effect>
                    <DropShadowEffect
                      BlurRadius="0" Color="#FFFFFFFF" Direction="325" ShadowDepth="1" />
                  </Path.Effect>
                </Path>
                <Path
                  x:Name="waves" Stretch="Fill"
                  Height="9" StrokeThickness="0.7"
                  Data="M2.7351642,0.50000001 C2.7351642,0.50000001 11.161155,5.6152308 2.735003,11.583 M1.4981242,2.1960007 C1.4981242,2.1960007 7.9036773,5.745693 1.4980017,9.8870007 M0.50007378,4.1370013 C0.50007378,4.1370013 4.3564552,6.053309 0.50000002,8.2890013"
                  Stroke="#FF5B5B5B" Margin="5.877,0,0,0"/>
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger Property="Tag" Value="IsMuted">
                  <Setter TargetName="waves" Property="Visibility" Value="Hidden" />
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>

    </ResourceDictionary>
  </UserControl.Resources>

  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>

    <Button
      x:Name="minButton" Style="{StaticResource MinVolButtonStyle}"
      Width="12" Height="12" ToolTip="Min Volume" Grid.Column="0"
      Click="MinimizeVolume" />

    <Slider
      x:Name="slider" Style="{DynamicResource VolumeSliderStyle}"
      IsMoveToPointEnabled="True" Focusable="False"
      Value="0" Minimum="0" Maximum="1000" Height="12" Grid.Column="1"
      ValueChanged="SetToolTip" Margin="1,1,0,0" SmallChange="1" />

    <Button
      x:Name="maxButton" Style="{StaticResource MaxVolButtonStyle}"
      Width="12" Height="12" ToolTip="Max Volume" Grid.Column="2"
      Click="MaximizeVolume" />

  </Grid>
</UserControl>